home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / business / istar.lha / Docs / Using Istar < prev    next >
Text File  |  1996-09-14  |  83KB  |  1,635 lines

  1. USING ISTAR
  2.  
  3. This is a step-by-step tutorial on how to make good use of Istar.  We take 
  4. real life kinds of tasks you might want to use it for and guide you in 
  5. building knowledge bases (KBs) of various kinds, to teach you some of the 
  6. features of Istar, and also to prod your thinking in how you could use it.
  7.  
  8.       Before you start here, read the sections "How do I start it?" and
  9. "Going further" in the <Driving Istar> document.  This guide is at a higher 
  10. level: it does not describe the features of Istar so much as when you might 
  11. make use of them, for what purposes.
  12.  
  13.       We present several sections here, each a small project with Istar of
  14. about quarter of an hour.  Each is designed to let you see what Istar could 
  15. be useful for and at the same time how to employ its facilities.  It 
  16. provides an introduction not just to use of Istar facilities but to the 
  17. creation of KBs in general.  You will find some useful tips.  The first 
  18. eight or so sections take you through some of the potential benefits of 
  19. knowledge based systems and introduce the main features.  But the KB you 
  20. build during these is far from accurate.  Only towards the end do we 
  21. consider how to make the KB more accurate.
  22.  
  23.       At the end you should be able not only to drive Istar but to take
  24. your first steps in building real knowledge bases.  Have fun.
  25.  
  26.  
  27. 1.  EVALUATING STOCKS AND SHARES
  28.  
  29. Suppose your friend asked you for advice on buying stocks and shares.  As 
  30. an alternative to talking or writing to him you could give him a knowledge 
  31. base.  Then he could run it, it would ask him questions about a company he 
  32. is interested in and would offer advice.
  33.  
  34.       In this section you will create a (much simplified) knowledge base
  35. (KB) that gives such advice.
  36.  
  37.       What other reasons are there for building such a KB?
  38.  
  39.       (a)  For yourself: it would remind you at a later date of the advice
  40.       you were giving; so a KB can be your memory.
  41.  
  42.       (b)  This could be useful for legal reasons; so a KB can be a precise
  43.       record of knowledge.
  44.  
  45.       (c)  You could provide it to 100 friends and acquintances, almost as
  46.       easily as to the initial friend; a KB can be a distribution
  47.       mechanism.
  48.  
  49.       (d)  You could sell it.
  50.  
  51. So, let's start building it.
  52.  
  53. #  Fuzzy knowledge.  Buying shares depends on 'fuzzy' factors like the 
  54. quality of the management, the strength of the market, etc. as well as on 
  55. quantitative ones like share price.  So we will use Bayesians to build our 
  56. KB - these allow accumulation of fuzzy evidence for and against various 
  57. propositions.  In the top-right window (Item Types) select 'Bayesian'.
  58.  
  59. #  Drawing an inference net.  Draw a box (Driving step 3) towards the right 
  60. of the screen and name it 'Buy It' (Driving step 8).  (Note the wee 'OK' 
  61. button to the right of the Label gadget; it is a version of the main one 
  62. further below, there for your convenience when all you are doing is to fill 
  63. in a name or meaning.)  This is the 'goal' item, the thing we want to find 
  64. out, the overall purpose of our KB.
  65.  
  66. #  Draw two more boxes a couple in inches to the left of 'Buy It', calling 
  67. them 'Will grow' and 'More profits', which express the ideas that the 
  68. company will grow in the future and that its profits are likely to 
  69. increase.
  70.  
  71. #  (Naming.  You can use longer names if you wish, but the shorter the 
  72. better.  A good rule for naming of this kind of fuzzy qualitative concept: 
  73. make the name a short proposition rather than a numeric value.  So just 
  74. 'Profits' can be confusing since it could mean "Profits are likely to 
  75. increase" or "The numerical value of last year's profits".)
  76.  
  77. #  Both are good indicators that shares in the company are worth buying, so 
  78. we link them to 'Buy it'.  Draw a link from 'Will grow' to 'Buy it' and 
  79. from 'More profits' to 'Buy it'.  (Your KB should now resemble a V on its 
  80. side if the two antecedents, 'Will grow' and 'More profits', are to the 
  81. left of 'Buy it' and slightly higher and lower than it.)
  82.  
  83. #  Run it (Driving step 11) with a company in mind - fictitious or real. 
  84. It will ask you to provide slider values that represent your degree of 
  85. belief, first your belief that the company will grow, then your belief that 
  86. the company's profits will increase.  Belief is positive to the right, 
  87. negative to the left, the further from the centre, the stronger your 
  88. belief.  (Note: at this stage, it just puts the name before you.)
  89.  
  90. #  Look at the result (Driving step 12).  Not very interesting yet and 
  91. probably totally wrong in its result, but you have built your initial KB. 
  92. Not really ready for your friend, so let's add some more knowledge.
  93.  
  94. #  What determines whether a company - any company - will grow?  There are 
  95. many factors, and we'll add a few below.  But for now we'll only add two: 
  96. the company is in a growth sector of the economy and the company has good 
  97. management.  So add two antecedents to 'Will grow' (draw two boxes with 
  98. names e.g. 'Strong sector' and 'Good management', and link them to 'Will 
  99. grow').  Now a create a couple of antecedents for 'More profits' and link 
  100. them in: the company has a good financial history ('Good fin hist') and the 
  101. company has low overheads ('Low overheads').  Now the KB looks like a 
  102. branching tree on its side.
  103.  
  104. #  But most KBs are not pure trees but networks.  Connect 'Good management' 
  105. to 'More profits', showing that we believe that increases in profits are 
  106. more likely with good management.
  107.  
  108. #  Run the KB; it will now seek your degree of belief about four things: 
  109. Strong sector, Good management, Good fin hist and Low overheads.  Make some 
  110. positive, some negative.
  111.  
  112. #  Save it, by clicking the 'Save As' button on the main control panel (top 
  113. left).
  114.  
  115. #  To summarize, in this section we have:
  116.  
  117.       #  Noted several reasons for building a KB.
  118.       #  Used bayesian attributes/items to represent fuzzy knowledge ..
  119.       #  .. in terms of degrees of belief.
  120.       #  Drawn an inference net to evaluate attractiveness.
  121.       #  Run it.
  122.  
  123.  
  124.  
  125. 2.  DECISION SUPPORT - WHAT-IFFING
  126.  
  127. A KB like the one you have just created can be used in a decision support 
  128. mode.  If we run it several times giving different answers each time then 
  129. we can see the effect of the various factors.  This is called what-iffing. 
  130. From this we might find that certain factors are more important than others 
  131. and this can help us plan e.g. where to put resources.
  132.  
  133. #  Run the KB (Driving step 11 and 12) with Strong Sector and Good fin hist 
  134. having strong positive belief (100) and Good Management and Low overheads 
  135. having strong negative belief (-100).  The result should be slightly to the 
  136. left of centre, around 33%.  (Notice that your input is in terms of degrees 
  137. of belief while the answer is in terms of probability, but visually they 
  138. should be similar at present: left of centre is negative indication, right 
  139. is positive.)
  140.  
  141. #  Now run it again (shortcut from the data panel to the action panel by 
  142. pressing the OK-Act button rather than the OK button).  Reverse the answers 
  143. and you should obtain a slightly positive indication, 66%.
  144.  
  145. #  We can derive some initial knowledge from this: the combination of Good 
  146. management and Low overheads is a stronger indication of whether to buy 
  147. than the combination of Strong sector and Good financial history.  (That 
  148. assumes our knowledge base is correct and complete, of course, which is 
  149. certainly is not!)  This is the way we use KBs for decision support: try 
  150. various combinations of factors against others.
  151.  
  152. #  But is there any overriding factor?  Run again, giving the first two 100 
  153. and the second two -100.  The result should again be slightly positive. 
  154. Then try other combinations of pairs of 100 and -100.
  155.  
  156. #  What should happen is that the pair that contains Good management should 
  157. always determine the final result.  What this means is that good management 
  158. is a more important indicator than the others.  In looking at the KB it 
  159. should be obvious why this is so:  Good management feeds its influence 
  160. through to the final goal ('Buy it') by two routes while the others feed 
  161. their influence by only one.  All other things being equal, the more routes 
  162. by which a factor feeds through to the goal the more important it becomes.
  163.  
  164. #  But in most real KBs all other things are not equal; the links 
  165. themselves have varying strengths (weights).  So you cannot determine the 
  166. strong factors merely by looking at the net; you must run it to find out.
  167.  
  168. #  (Above we always divided the factors into pairs and always gave them 
  169. extreme values; that was just to give you the idea; in reality all sorts of 
  170. values would be used and we might vary only one or two factors at a time.)
  171.  
  172. #  To summarize, in this section we have:
  173.  
  174.       #  Used the KB in what-if mode.
  175.       #  Thereby found which factors are important.
  176.       #  Noted the effect of parallel inference paths.
  177.  
  178.  
  179.  
  180. 3.  MAKING IT EASIER AND TIDIER TO USE
  181.  
  182. When your KB becomes larger the above procedure becomes a bit cumbersome. 
  183. Here are a couple of things to tidy it up and make it less cumbersome.
  184.  
  185. #  First, let us put in proper question text for the degrees of belief. 
  186. What we do is to provide question text for each of the four antecedent 
  187. factors.  To do this, for each in turn do the following:  Click with the 
  188. RIGHT mouse button on the middle of the box expressing the item.  (The 
  189. attribute panel should appear; if nothing happens, it is probably that the 
  190. main easel is not active; to make it active, click on the easel with the 
  191. left mouse button as per normal Intuition practice.)  In the attribute 
  192. panel, find the first long string gadget, the 'Q' to the right of 'User 
  193. supplied'.  This is the question text.  Click in it and fill in the 
  194. question texts, e.g. "Do you believe the company is in a strong sector?", 
  195. "What is your degree of belief that the company has good management?", 
  196. "Have they a strong financial history?", "Do you believe they have low 
  197. overheads?"  Now, run the KB again, and your questions should appear.
  198.  
  199. #  Second, it's a nuisance having to bring up the attribute data panel each 
  200. time to see the result.  We can show the result directly on the main easel. 
  201. To do this bring up the attribute data panel for 'Buy it' (Driving step 8 
  202. or 12).  At the left end of the third row of gadgets is a check box 'Show 
  203. Value'.  Click that so that a tick appears.  Click Ok-Act to bring up the 
  204. action panel and run the KB again.  You should see a short black line part 
  205. way across the bottom of the 'Buy it' box.  This shows its current value as 
  206. a probability; the longer it is, the higher the probability or degree of 
  207. belief in the concept expressed by the box.  Run it a few times and you can 
  208. see how the value changes, not so precisely as with the data panel but 
  209. enough to give a useful indication.  (Note: the show value facility does 
  210. not work for all data types at present; only booleans, probabilities, 
  211. proportions and bayesians.)
  212.  
  213. #  Third, you can do this with all the antecedents too, showing their 
  214. values.
  215.  
  216. #  Fourth, if you just want to change a single input antecedent, you don't 
  217. have to reset and re-ask all the others.  Suppose you want to see the 
  218. effect of varying just 'Good management'.  Click on it with the left mouse 
  219. button to bring up an action panel for it.  Then hit Reset and Infer.  You 
  220. will be asked only for Good management.  But the answer will be propagated 
  221. through to 'Buy it'.  Try this several times.  Forward propagation does not 
  222. stop at the current goal (i.e. for which an action panel has been raised), 
  223. but spreads throughout the entire KB net as far as possible.  By varying 
  224. 'Good management' between its extremes you can see the maximum potential 
  225. effect it can have, which is a good indication of its importance.  (Note: 
  226. For this to work properly, you should ensure that the final goal, 'Buy it', 
  227. has been answered.  If it is not answered then the effect of 'Good 
  228. management' will not be propagated through to it because propagation 
  229. usually only occurs once an attribute is answered.)
  230.  
  231. #  (There is also an override facility, by which you can do similar what-
  232. iffing with items in the middle of a net; but we will not cover that here.)
  233.  
  234. #  Goal lists.  On the action panel you will see an 'Add Goal' button. 
  235. Click this and that attribute will be added to the Goal List, which appears 
  236. as the bottom right panel of the control screen.  Using the goal list makes 
  237. things even easier because you can have several attributes on the goal list 
  238. and reset and infer them all with just two button clicks (on the top-left 
  239. main control panel).  So if you wanted to try what-iffing with just three 
  240. attributes of a large KB you would place those on the goal list.
  241.  
  242. #  Not yet saleable.  Your KB is probably tidy enough to be usable by you 
  243. and by your friend if s/he is sympathetic.  But it is not yet tidy enough 
  244. to sell (even supposing that the knowledge is complete and accurate).  That 
  245. involves setting up goal lists etc. which we will not discuss here.  But 
  246. this version of Istar is not designed to take you all the way to building a 
  247. commercially attractive KB.
  248.  
  249. #  To summarize, in this section we have:
  250.  
  251.       #  Attended to ease of use and tidiness.
  252.       #  Introduced question text.
  253.       #  Used the Show Value facility.
  254.       #  Inferred single attributes on their own.
  255.       #  Used goal lists.
  256.  
  257. In some versions a simple shares advisor can be found in the KBs/Shares 
  258. file.  It is far from complete, and must not be used to give advice.  But 
  259. loading and running it could be instructive.
  260.  
  261.  
  262. 4.  KNOWLEDGE REFINEMENT AND CLARIFICATION
  263.  
  264. By now you have probably thought about other factors that should be taken 
  265. into account when deciding whether to purchase shares.  Also, you have 
  266. probably thought that concepts like 'Good management' are a bit vague.
  267.  
  268.       You'd be right on both accounts.  What has happened is that in the
  269. act of putting the KB together and then trying it a few times your thinking 
  270. about the domain of knowledge has been stimulated.  This can be just 
  271. remembering things; it can also be actual refinement or clarification of 
  272. your own knowledge.  Istar can help you to clarify and refine your 
  273. knowledge, which is especially useful is decision support.
  274.  
  275. #  The first step in refinement or clarification of knowledge is to set 
  276. down precise meanings.  By 'Buy it' we mean something like "This company's 
  277. shares are worth buying at the moment."  So bring up the attribute details 
  278. panel for 'Buy it'.  Top right is a string gadget for 'Meaning'; into it 
  279. put text similar to that.
  280.  
  281. #  Important Tip:  Normally you should fill in the meaning as soon as you 
  282. create the box.  (We have done so later here because of the order in which 
  283. these tutorial sessions have been planned.)
  284.  
  285. #  (Tip:  Notice several things that have been specified when making the 
  286. meaning of 'Buy it' precise:
  287.  
  288.       #  What we buy: "shares"
  289.       #  Which we buy:  "of this company"
  290.       #  The situation (when, where, etc.): "at the moment".
  291.  
  292. Making meaning precise often involves asking what, when, where, who, which, 
  293. etc.)
  294.  
  295. #  Now make the meaning of 'Strong sector' precise.  What about: "The 
  296. company operates is a strong and growing sector."  Notice the inclusion of 
  297. growth as well as general strength.
  298.  
  299. #  This inclusion of growth sets us thinking: we are happy about steady, 
  300. well-founded growth, but maybe not about artificially induced boom-type 
  301. growth.  So, for now, go back to 'Strong sector' and alter its Meaning to 
  302. "... strong and growing (but steady, not boom) sector."  (Note how we are 
  303. frequently accessing the Meaning gadget, and how useful is the wee 'OK' 
  304. button.)
  305.  
  306. #  Now make the meaning of 'Low overheads' precise; devise your own text.
  307.  
  308. #  Now try 'Good management'.  This one's perhaps not so easy to define. 
  309. The two links we have from it, to 'Will grow' and 'More profits', speak of 
  310. two aspects of quality of management.  The link to 'Will grow' speaks about 
  311. the extent to which the management has a vision to grow the company and has 
  312. the skills to do so, such as marketing.  The link to 'More profits' speaks 
  313. more about the financial policies of the management: is their spending 
  314. under control, is their investment policy sound, and so on.  So, as we try 
  315. to make the meaning precise we see that perhaps there are several things 
  316. currently bound together in the single concept 'Good management'.
  317.  
  318. #  We have several options here.  We can retain the the single, composite 
  319. concept.  We can split the concept into several others.  Or we can do both. 
  320. We will do both, first splitting it and then reinstating it for usability 
  321. purposes.
  322.  
  323. #  Pull the 'Good management' box over to the left of the others, leaving 
  324. enough space to place a couple of boxes between it and the others.  The 
  325. links extend to follow it.
  326.  
  327. #  Draw a box and label it 'Vision for growth' and give it a meaning like 
  328. "The management of this company has a vision for growth."  Place it 
  329. somewhere north-east of 'Good management'.
  330.  
  331. #  Now we will redirect a link.  Hold the left shift button down.  This 
  332. enables you to 'pick up' the end of a link and move it to another box. 
  333. Place mouse cursor over the end of the link from 'Will grow' where it 
  334. enters leaves the 'Good management' box and press left mouse button and 
  335. drag the mouse.  The link should now leave the box and follow the mouse. 
  336. Release the end of the link over the new 'Vision for growth' box.
  337.  
  338. #  If you run the KB now you will be asked about 'Vision for growth' as 
  339. well as all the others.
  340.  
  341. #  (Note:  The ability to redirect a link so easily is a boon: in many 
  342. pieces of software you have to delete the link and draw a new one.  While 
  343. this is not much of a problem here, once you have added weights to the link 
  344. and perhaps routed it around the diagram you lose all that information and 
  345. have to reinstate it all again.)
  346.  
  347. #  Now draw a box 'Good fin policy', somewhere south east of 'Good 
  348. management', with meaning like "The management of this company has sound 
  349. financial policy."  Redirect the link between 'Good management' and 'More 
  350. profits' in the same way as above so that it now starts at 'Good fin 
  351. policy'.
  352.  
  353. #  (Notice:  We still have a 'Good management' box but it is not connected 
  354. to the goal 'Buy it'.  If you run the KB now it will no longer ask about 
  355. 'Good management'; backward chaining only reaches those parts that are 
  356. connected to the goal.  We could delete it, but as there is no need to do 
  357. so and as we sometimes find we need such items later, just leave it and 
  358. ignore it.  We will come back to it at the very end, making the KB more 
  359. usable.)
  360.  
  361. #  Now that we have identified sound financial policy as a relevant concept 
  362. in our KB we notice its similarity with good financial history.  Assuming 
  363. that the management has been in place for some time, presumably the good 
  364. financial history is due in part to sound financial policy.  So we really 
  365. want 'Good fin policy' to link into 'Good fin hist' as well as directly 
  366. into 'More profits'.  Link them (drawing a line from the right hand edge of 
  367. 'Good fin policy' into 'Good fin hist').
  368.  
  369. #  To come to think of it, maybe we shouldn't have 'Good fin hist' at all. 
  370. Maybe it is almost completely subsumed under 'Good fin policy' as far as 
  371. 'More profits' is concerned?  So we will merely delete the link from 'Good 
  372. fin hist' and 'More profits' so that the former no longer has influence on 
  373. the latter.
  374.  
  375. #  (We have the option of at least two other courses of action: delete the 
  376. item 'Good fin hist' or merge it with 'Good fin policy'.  See the section 
  377. on Common Net Manipulations.  Deletion of an item is more drastic than 
  378. deletion of a link and in knowledge refinement it is often to err on the 
  379. side of caution.  Even though the two concepts appear similar as far as 
  380. 'More profits' is concerned, they are not in fact identical in terms of 
  381. their actual meaning, and it might come about that later parts of the KB 
  382. require 'Good fin hist' as distinct from 'Good fin policy'.)
  383.  
  384. #  Deleting a link.  With right mouse button click over the link between 
  385. 'Good fin hist' and 'More profits'.  Up comes a Relationship Instance panel 
  386. with details of this particular link.  (Notice, in passing, the Unary Op 
  387. type ('Normal') and the Weight figures towards the bottom which is 
  388. contained in four small boxes and should read 3,1, 1,3.)  But ignore all 
  389. else but the 'Delete' button.  Click it.  The link disappears.
  390.  
  391. #  Save the KB as 'R1' so we can pick it up later.
  392.  
  393. #  While we have been manipulating the concepts above, maybe you have 
  394. thought of other factors that contribute to a belief that this company's 
  395. shares are worth buying?  If so, you can always add it: just place a box 
  396. for it, link it to 'Buy it' and give it a name and meaning.  Maybe you've 
  397. thought of something extra that contributes to a belief in 'Will grow' or 
  398. any other box.  Add the new concept(s) in the same way.
  399.  
  400. #  Negative evidence.  Lastly, for now, maybe you have also thought of some 
  401. factor that would lower your belief in 'Buy it'.  For instance, even if we 
  402. believe the company will grow and its profits will increase, if there are 
  403. rumours that its management have been involved in shady dealings, then 
  404. perhaps it would be dangerous to buy shares.  So, in a suitable space to 
  405. the left of 'Buy it' draw a box 'Shady dealing' with meaning "The 
  406. management is believed to have been involved in shady deals."  Now start 
  407. drawing a link from 'Shady dealing' towards 'Buy it', but while you are 
  408. drawing it, hit the Minus key (to right of '0' on top row of keyboard). 
  409. You should see the line change colour from red to black, indicating that it 
  410. is now a negative link.  (If you change your mind, and want to change it 
  411. back, hit the Plus key.)  Then release the link over 'Buy it'.
  412.  
  413. #  Negative evidence acts in a similar way to normal evidence, except that 
  414. its effect is reversed.  When you run a KB with a negative link, as you 
  415. increase belief in the negative evidence then it decreases belief in its 
  416. consequent.  Try it in the what-iffing mode described above.
  417.  
  418. #  Click right mouse button over the negative link to obtain its 
  419. Relationship Instance panel.  Notice that the Unary Operator is 'Negate'. 
  420. For all the positive links in your KB the Unary Operator is 'Normal'.  If 
  421. you ever want to change a link from positive to negative or vice versa once 
  422. it is drawn, then bring up this panel and change its Unary Op type (click 
  423. the wee button to left of its name, as described for Inference type in 
  424. Driving step 13).  Then click 'OK'.
  425.  
  426. #  Notice how our process of knowledge refinement works, in several ways:
  427.  
  428.  
  429. and of course there are others.  Istar provides an easy to use too to aid 
  430. the process of knowledge refinement and clarification.
  431.  
  432. #  To summarize, in this section we have:
  433.  
  434.       #  Found several ways of refining knowledge:
  435.       #  .. by making meanings precise
  436.       #  .. by splitting a concept to become more than one
  437.       #  .. by merging two concepts that are (almost) the same
  438.       #  .. by thinking of other concepts
  439.       #  Noted how these happen naturally as we build the KB.
  440.       #  Used the facility to redirect links.
  441.       #  Deleted a link.
  442.       #  Used negative evidence.
  443.  
  444.  
  445.  
  446. 5.  KNOWLEDGE COMMUNICATION AND MUTUAL UNDERSTANDING
  447.  
  448. Imagine carrying out knowledge refinement with a colleague, both of you 
  449. around the screen.  To have someone to bounce ideas off is often very 
  450. fruitful.  And it is often of benefit to ensure the newly emerging ideas 
  451. are communicated to a colleague - and understood by a colleague.  Istar is 
  452. designed for partnership working, where two (or a few) people are around 
  453. the screen.
  454.  
  455.       (Note: This is NOT the same as group working where each has their own
  456. screen linked by some electronic means, though in principle Istar could 
  457. support that.  What we are talking about here is the technically more 
  458. modest situation - but probably socially and practically more useful 
  459. situation - where two or more people sit around a single screen.)
  460.  
  461.       You have a partially developed KB up in front of you and your
  462. colleague.  Think of the knowledge refinement steps we have been through:
  463.  
  464.       #  making meanings precise
  465.       #  a concept becomes more than one
  466.       #  two concepts are seen to be (almost) the same
  467.       #  thinking of other concepts.
  468.  
  469. If a colleague sat with you, there are four things that could be going on. 
  470. The first two occur when knowledge is being refined, as above.
  471.  
  472.       #  First, your colleague just observes your actions and listens to
  473.       you as you refine your knowledge.  Then your thinking and reasoning
  474.       would be communicated.  S/he would understand why you believe, for
  475.       instance, why 'Good management' is not a sufficiently precise
  476.       concept.  Using Istar helps this communication and mutual
  477.       understanding of what are often ill-defined areas.
  478.  
  479.       #  Second, your colleague takes an active part in the refinement
  480.       process, as the two of you discuss whether 'Good management' should
  481.       be split in two, in three, or kept as a whole.  Using Istar
  482.       facilitates this discussion by providing a graphical 'language' in
  483.       which to express and try out ideas.
  484.  
  485. The third and fourth occur when knowledge is already in a reasonably clear 
  486. state and is merely being set down into the KB without being refined. 
  487. (This might happen, for instance, when you are entering knowledge from a 
  488. rulebook or knowledge of established good practice.)
  489.  
  490.       #  Third, your colleague just observes you building the KB.  But the
  491.       order in which you build it communicates something of importance.  So
  492.       does your 'body language' while building it - for instance, the act
  493.       of moving 'Good management' to the left to make room gives
  494.       information about your intentions.  Istar is then facilitating simple
  495.       one-way, communication, but of more than pure information.
  496.  
  497.       #  Fourth your colleague takes an active part in the construction
  498.       process: "Haven't you forgotten X factor?", "Is that how you
  499.       interpret that rule; I would interpret it in a different way."
  500.       Again, Istar facilitates communication, but this time a two-way
  501.       communication.
  502.  
  503.       In addition to its clear graphical display and intuitive mechanisms
  504. for drawing knowledge bases, it has been found that a third facility is 
  505. very important for communication:  the flashing up of the meaning of an 
  506. item at the bottom of the screen as the mouse runs over it.  You've almost 
  507. certainly noticed it, but if not, just move the mouse over the items of 
  508. your KB.  (If nothing happens, it is probably because the main easel window 
  509. is not active, and so you must make it so by clicking over its background.)
  510.  
  511.       Superficially like the speech bubbles that come up in MUI, Windows or
  512. the Mac, that explain what a button is for, this has a rather more 
  513. sophisticated use in showing high level meaning rather than low level 
  514. action.  It was found during the INCA project (Basden, Brown, Tetlow and 
  515. Hibberd, 1996) that the knowledge engineer (yourself) made little use of it 
  516. since it was not in the main field of view but the onlooker (your 
  517. colleague) made enormous use of it to see the meanings of the various items 
  518. of itnerest.
  519.  
  520.       To summarize, in this section we have:
  521.  
  522.       #  Noted how Istar can aid communication in four ways
  523.       #  .. by working with a colleague
  524.       #  .. who either actively takes part or just observes.
  525.       #  Noted the use of Istar's facility to show meaning.
  526.  
  527.  
  528.  
  529. 6.  TYPES OF BENEFIT OF A KB
  530.  
  531. We have now discussed four types of benefit that can accrue from a KB.  In 
  532. the first two:
  533.  
  534.       #  simple evaluation of the attractiveness of a share
  535.       #  what-iffing to find significant factors
  536.  
  537. the benefit accrues from running a completed KB, while in the latter two,
  538.  
  539.       #  refinement and clarification of your knowledge and
  540.       #  communication and discussion,
  541.  
  542. the benefit accrues from the process of constructing the KB, rather than 
  543. running it.  For the remaining sections we will return to types of benefit 
  544. that can accrue from running a completed KB, and how these benefits 
  545. influence the form and style of the KB:
  546.  
  547.       #  predicting behaviour
  548.       #  selection from known options
  549.       #  selection from undefined options
  550.       #  causal modelling
  551.       #  diagnosis
  552.       #  critiquing.
  553.  
  554. All these assume a completed KB and the benefits accrue from running it. 
  555. The KB you have already built is general purpose and can fulfil most of the 
  556. purposes but with varying degrees of clumsiness.  For most effective use 
  557. the KB should be tailored to the purpose for which it is designed.
  558.  
  559.       I say purposes rather than purpose because many KBs hold knowledge
  560. for more than one purpose.  For instance the Wheat Counsellor KB first 
  561. predicted what diseases were likely in a crop of winter wheat and then 
  562. selected the appropriate preventative treatment.  But we will look at the 
  563. style required for each purpose, and as we do, will meet and learn about 
  564. various facilities of Istar.
  565.  
  566.  
  567. 7.  PREDICTING THE BEHAVIOUR OF YOUR SHARE
  568.  
  569. Your knowledge has been refined and the KB now expresses what you believe 
  570. about share purchasing (or let us suppose so).  As you might have realised, 
  571. your KB can be used to predict outcomes.  Suppose you have knowledge of a 
  572. particular company and its situation.  Then if you poke this information 
  573. into the KB then it will predict the attractiveness of the shares of that 
  574. company to investors.
  575.  
  576. #  All you have to do is to run the KB; there is no change required to the 
  577. knowledge.  (Bring up the action panel for 'Buy it' and click Reset and 
  578. Infer.)
  579.  
  580. #  What this underlines is that a well designed KB is actually multi-
  581. purpose when run:  for evaluation, critique, understanding, communication 
  582. and prediction.  Just as with any good model.  So, in a sense, a good KB is 
  583. a model of reality and Istar can be seen as modelling software.  But, as 
  584. those of you who have been involved in modelling will have realised, a 
  585. rather different style of software.
  586.  
  587. #  So far you have been dealing with bayesians, representing fuzzy 
  588. concepts.  But much modelling deals with harder or more precise concepts, 
  589. and for these we need numbers, booleans, etc.  Istar provides a host of 
  590. these (though the current version as of June 1996) is still under 
  591. development.  For the full list, see the file <Value Types>.  For now we 
  592. will use integers and booleans.
  593.  
  594. #  A boolean is like a sharp, hard bayesian, the common true-false, yes-no 
  595. distinction.  Bring up the attribute details panel for 'Strong sector'.  On 
  596. the second row of gadgets, headed 'Value', the leftmost shows the value 
  597. type (Bayesian).  Click on the wee type-change gadget at its left-hand end 
  598. and a list of value types appears.  Select Boolean (and hit its OK button). 
  599. (If you get a warning message that value type is inconsistent with 
  600. inference method, it just means that 'Strong sector' is set to 'Infer' 
  601. rather than 'User supplied'; ignore it for now as it will have no effect 
  602. since there are no antecedents.)  You will see the value type in the 
  603. attribute detail panel change - but it has not come into effect yet.  So 
  604. click 'OK'.  Then bring up the attribute detail panel again, and you will 
  605. see that the value gadget itself, to the right of the value type 
  606. identifier, is no longer a slider but a checkbox.  You have changed value 
  607. type.
  608.  
  609. #  Now run it, and you will see that when it asks about 'Strong sector' it 
  610. no longer gives you a slider but a check box.  (Rather ugly, this tiny 
  611. checkbox; in future versions there will be an option of a larger gadget 
  612. saying Yes/No.)
  613.  
  614. #  Now for a numeric value.  We'll use floating point numbers here, though 
  615. there are other types including integers, ratios, ordinals, enumerators, 
  616. proportions, etc.  First, we'll practice with just numeric values, then 
  617. we'll use a numeric value in our bayesian network, which takes a bit more 
  618. thought.  Because: how can we integrate a numeric concept like Share Price 
  619. into a fuzzy propositional concept like whether or not to buy the share? 
  620. Think about it as we practice some numerics.
  621.  
  622. #  Distance is half of acceleration times the square of time (if I remember 
  623. my school physics correctly).  On the Select Item Type panel click on 
  624. Float.  1.  In a clear part of the easel (notice how it smoothly scrolls as 
  625. you move the mouse - a wonderful feature of the Amiga!) lay down an item 
  626. and label it 'Distance'.  This will be our goal.  2.  Then lay down three 
  627. antecedents to the left of it: 'Time', 'Acceleration' and 'Constant'.  3. 
  628. Link all of them to 'Distance'.  4.  Bring up the attribute details panel 
  629. for 'Distance' and locate the Inference Method type gadget.  It should lie 
  630. just to the right of the 'Infer' radio button and should say "X = A + B + C 
  631. .." or something similar, meaning that the value of this attribute is 
  632. calculated by adding together the values of all the antecedents.  We want 
  633. multiplication, so click on the wee type-change button at its left hand end 
  634. and select "X = A * B * C .." from its list.  Click OK.  5.  But we want 
  635. the square of time, not time itself: draw a second link from 'Time' to 
  636. 'Distance', putting a bend in it (Driving step 5) to visually distinguish 
  637. it from the first one; having two links gives the square of distance, 
  638. having three will give the cube, etc.  6.  Bring up the attribute details 
  639. panel for 'Constant', set the derivation radio button to 'Const' and set 
  640. the value to '0.5', click its OK button.
  641.  
  642. #  What you have is a wee inference net that says the result is the product 
  643. of Distance, Distance, Acceleration and the constance, 0.5.  Bring up the 
  644. action panel.  Run it, giving a time of 2 and an accelration of 3, say. 
  645. The result should appear as 6.  With this you can predict how far a stone 
  646. will fall from the top of a tower block in a given time.  (Or, as mentioned 
  647. in the first paragraph, you can put this to other uses such as evaluating 
  648. whether the stone will reach the 23rd floor in three seconds, such as doing 
  649. a what-if on different strengths of gravity, such as refining your 
  650. knowledge of what factors contribute to distance fallen.)
  651.  
  652. #  Now, how can we link a numeric concept into a bayesian network?  The 
  653. answer is that we cannot meaningfully link it in directly.  Instead, we 
  654. must often compare the numeric attribute with something and emerge with a 
  655. truth statement.  So, for instance, we could say that if the Share Price is 
  656. going up (greater than it was a week ago) then we predict that the share is 
  657. worth buying.  So let's put that in.  (I know that knowledge is wrong; you 
  658. can refine it below!)  It takes several stages, since you will learn and 
  659. use several new features.
  660.  
  661. #  First, place two Float boxes south west of 'Buy it' with enough space 
  662. for another between them.  Label them 'Share Price' and 'Price last week', 
  663. giving meanings of "Current share price of this company" and "The share 
  664. price of the company a week ago".  If you like, give them suitable question 
  665. text.
  666.  
  667. #  Now select Boolean item type, draw an item between 'Buy it' and these 
  668. two.  Label it 'Shares Rising' with a meaning "The share price is rising".
  669.  
  670. #  Now link 'Share Price' as antecedent to 'Shares Rising'.  Then link 
  671. 'Price last week' similarly.  Do it in that order.
  672.  
  673. #  Bring up the attribute details panel for 'Shares Rising'.  Change the 
  674. inference method to "A > all".  What this inference method does is to see 
  675. whether the first antecedent is greater than all the rest (that is why the 
  676. order was important).  It returns a boolean result (unlike most inference 
  677. methods, in which the consequent is of the same value type as the 
  678. antecedents).  Click OK.
  679.  
  680. #  (If you wish to see this in operation, run the wee KB in which 'Shares 
  681. Rising' is the goal, giving various pairs of values for 'Share Price' and 
  682. 'Price last week'.)
  683.  
  684. #  Now link 'Shares Rising' as antecedent into 'Buy it'.  Strictly, the 
  685. bayesian accumulation inference method (which 'Buy it' has) needs bayesian 
  686. actecedents.  But for your convenience Istar is tolerant, making automatic 
  687. conversions from probability and boolean.  If the antecedent is a simple 
  688. probability it has no a-priori and this is assumed to be half (0.5, 50%). 
  689. If the antecedent is boolean, as here, then it is treated as a probability 
  690. with a value of either 0 or 100% with an a-priori of 50%.  (For details of 
  691. a-priori values, see below.)  You will find automatic value type conversion 
  692. quite frequently, for instance allowing you to mix integers and floats when 
  693. doing arithmetic.
  694.  
  695. #  Now run the whole KB, and see the effect of changing share price 
  696. compared with price last week.
  697.  
  698. #  Knowledge refinement:  You probably disagree with the idea that shares 
  699. should be bought when their price is rising.  Many will say they should be 
  700. bought when price is falling and sold when rising.  That simple rule was at 
  701. the centre the stock market crash of 1989, so I thought I'd put in its 
  702. opposite here!  You are free to correct my possibly wrong knowledge to the 
  703. conventional rule, and there are several ways of doing it:  (a) alter 
  704. inference method from "A > the rest" to "A < the rest" (and alter the label 
  705. and meaning of 'Shares rising' in line with that).  (b) (easier:) make 
  706. 'Shares rising' negative evidence for 'Buy it', by altering the unary 
  707. operator of its link to 'Negate'.  Probably, the real knowledge of the link 
  708. between share price movement and whether to buy is more complex, depending 
  709. on the rate of price rise or drop, how long it has been rising or dropping, 
  710. and what other dealers are doing.  It would be a good exercise to try to 
  711. work out a small knowledge base for this, now you have the ability to 
  712. connect numeric and bayesian information.
  713.  
  714.       In this section we have:
  715.  
  716.       #  noted the use of a KB for prediction as well as others
  717.       #  made use of numeric information
  718.       #  found one way of linking numeric and bayesian
  719.       #  noted there are two ways of negating knowledge.
  720.  
  721.  
  722. 8.  SELECTION: DECIDING WHICH SHARE TO PURCHASE
  723.  
  724. Istar can be used to select options, especially where the selection 
  725. criteria are fuzzy and make use of human 'judgement'.  This section looks 
  726. at one way of doing this.
  727.  
  728.       So far, our KB is run for a single company, and we have been
  729. evaluating whether its shares are, or predicting whether it shares will be, 
  730. worth buying, but we can also use it to select the best company from which 
  731. to buy shares.  To use our existing KB we must run it several times, once 
  732. for each company, and remember the result for each one.  That is, the 
  733. general purpose KB we have constructed can also be used for selection.
  734.  
  735.       But running it for each company can be inconvenient.  For a start, we
  736. need to remember the result for each.  To continue, there are situations 
  737. where there is common information and we find we are having to enter the 
  738. same information each time.  This section looks at one way of allowing 
  739. several selections in a single KB.
  740.  
  741.       This method would not normally be used for selecting between such
  742. varied things as company shares, but mainly for selection from a small and 
  743. static range of options.  For instance, to select the best of five alloys 
  744. from which to make machine parts, depending on their properties.  But we 
  745. will continue with our shares KB and assume we have two companies between 
  746. which we must make a decision: Acme plc and Bloggs Ltd.  Both are in the 
  747. Information Technology sector.
  748.  
  749.       What we must do is to create separate parts of the KB for each, one
  750. part for Acme, one for Bloggs, but using as much common knowledge as 
  751. possible.  (Current version of Istar does not have a knowledge duplication 
  752. facility, so we must do it manually.)
  753.  
  754. #  Load the KB you saved as 'R1'.
  755.  
  756. #  First, let's rename the existing KB as relevant to Acme.  Easiest way to 
  757. do this in our present version is to bring up the attribute details for 
  758. each attribute in turn and put an "A:" (for Acme) in front of both label 
  759. and meaning.  Do so.  Except for 'Buy it' which is better labelled 'Buy 
  760. Acme' and for 'Strong sector' which is common data and thus not specific to 
  761. either.  You can ignore the dangling 'Good fin hist'.
  762.  
  763. #  Now we build a similar KB for Bloggs.  Preferably underneath the current 
  764. one.  Create items for:  'Buy Bloggs', 'B: Will grow', 'B: Vision for 
  765. growth', 'B: More profits', 'B: Good fin policy', (but not for 'Strong 
  766. sector'), and link them in the same pattern as for Acme.  (Don't bother 
  767. duplicating 'Good fin hist'.)
  768.  
  769. #  Now link the common 'Strong sector' above Acme into 'B: Will grow'. 
  770. 'Strong sector' is common to both because both are in the same sector, I.T.
  771.  
  772. #  Make 'Strong sector' the first antecedent of 'B: Will grow', as 
  773. described in the following paragraphs ...
  774.  
  775. #  (A note about order of antecedents.  Bring up the attribute panel for 
  776. 'A: Will grow' and look at the bottom left corner List of Antecedents. 
  777. This tells you which items/attributes are the direct antecedents to this 
  778. one.  Notice that 'Strong sector' is first.  Now bring up that for 'B: Will 
  779. grow' (no need to send 'A: Will grow' away; Istar allows several such 
  780. panels to be up at the same time).  'Strong sector' should appear as second 
  781. in the list.  This is because we linked 'Strong sector' to 'B: Will grow' 
  782. after we linked the rest, not before; any new link is added at the end. 
  783. What this means is that if you run just 'Buy Acme' you will be asked about 
  784. sector strength first, while if you run just 'Buy Bloggs' sector strength 
  785. is asked second.  Normally this doesn't matter much because the order 
  786. should not affect the results (except for some order-sensitive inference 
  787. methods like "A > the rest").  The main concern is over usability; the user 
  788. - your friend of the first section, perhaps - might wonder why the two 
  789. parts behave differently and whether this has any significance.  The 
  790. attribute details panel allows you to change the order by selecting an 
  791. antecedent and making it first.  So select 'Strong sector' on the list and 
  792. click the nearby 'To 1' button.  It should jump to first in list.  And if 
  793. you run 'Buy Bloggs' now it should ask about sector strength first.)
  794.  
  795. #  (The other buttons by the antecedent list - A, R, X - give you 
  796. information.  'A' takes you to the named antecedent, bringing up its 
  797. attribute details panel.  'R' takes you to the Relationship Instance panel 
  798. for the relationship.  In both cases the original panel stays.  'X' brings 
  799. up a textual explanation of what goes on in the inference relationship - 
  800. but in the current version it is only 90% correct since it is still being 
  801. implemented.  Try them, sending each away when you have seen them.)
  802.  
  803. #  Now we can run the whole KB.  Send all attribute detail panels away. 
  804. Clear the Goal List (bottom right panel: select each and press 'Remove'). 
  805. Now make both 'Buy Acme' and 'Buy Bloggs' goals (remember: bring up their 
  806. action panels and click 'Add Goal' button).  Now run the whole KB by 
  807. clicking 'Reset Goals' and 'Infer Goals' on the main control panel.  It 
  808. should ask about strong sector only once, but all the other information 
  809. separately.  Notice how the backward chaining lends a certain intelligence 
  810. to the operation, in that all the Acme details are sought before any Bloogs 
  811. details.
  812.  
  813. #  Look at the results.  Unless you thought about it without being 
  814. prompted, this means you will have to bring up the attribute panels or each 
  815. - which can be cumbersome when you are selecting between a dozen options, 
  816. not just two.  We want a more convenient method.  We will look at two 
  817. methods.
  818.  
  819. #  Perhaps the simplest (when your goals are bayesians, probabilities, 
  820. booleans or proportions) is to set the Show Value flags on all the goals 
  821. ('Buy Acme' and 'Buy Bloogs'), so that the value or each is immediately 
  822. visible as a horizontal black line in each box on the main easel.  If you 
  823. move the boxes so that they are aligned vertically above each other, then 
  824. comparison is fast and easy.
  825.  
  826. #  The next method is more sophisticated, and more suited to numeric goals 
  827. which cannot be shown by the horizontal line.  We will add some inference 
  828. net to compare the two and provide the name of the winner.  In doing so you 
  829. will learn a new value type and couple more facilities of Istar.
  830.  
  831. #  On the Select Item Type panel, towards the bottom select 'Block'.  The 
  832. Block value type means that the attribute contains the DSAP (data structure 
  833. area pointer, the reference number) of a block of data in the KB.  Place 
  834. such an attribute/item to the right of the two goals, 'Buy Acme' and 'Buy 
  835. Bloggs'.  (Label: 'Best share', meaning e.g.: "This holds holds the DSAP of 
  836. the block of the share which is most attractive".)  Link them to it as its 
  837. attributes.
  838.  
  839. #  Bring up the attribute detail panel, and the inference method should be, 
  840. by default, "Which Max".  (If not, then change it.)  "Which Max" looks to 
  841. find which of the antecedents has the highest value and returns an 
  842. identifier to show which.  In our case the result is a DSAP of a block, but 
  843. it can be an index number if the consequent is integer or ordinal; see the 
  844. <Inference> file for more details.
  845.  
  846. #  (If you run it using 'Best share' as the goal - ignore the goal list, 
  847. bring up its action panel and click Reset and Infer - then the result will 
  848. be a number like 23720.  Now if you bring up the attribute details panels 
  849. for 'Buy Acme' and 'Buy Bloggs' you will see over the right hand side, 
  850. about 2/3 of the way down, a gadget 'DSAP' and one of them should be the 
  851. number you have just seen.  Rather meaningless since it is an internal 
  852. identifier.)
  853.  
  854. #  Now to convert this Block value (DSAP) into something more meaningful: 
  855. the name of the best share.  In the Select Item Type panel, select 
  856. 'String'.  Place a string item to the right of 'Best share' and link 'Best 
  857. share' into it as antecedent.  (You can call the new item 'Best share' if 
  858. you like as Istar allows duplicate names, but it's probably better to 
  859. differentiate it as a string version either by a different label or in the 
  860. meaning.)
  861.  
  862. #  (Notice how the colours of the labels in the various items/attributes is 
  863. a clue to the value type held.)
  864.  
  865. #  Now run the KB with this string 'Best share' as goal, and look at its 
  866. result.  It should contain as its value either of the strings, 'Buy Acme' 
  867. or 'Buy Bloggs'.  This string value can then be placed in a document 
  868. (though we will not do so here; in the current version of Istar this 
  869. facility is not available).
  870.  
  871. #  Which is the better method to show which share to buy?  It depends.  But 
  872. the former has two advantages.  One is that it is more immediately 
  873. graphical: look for the longest line.  But, more importantly, suppose both 
  874. results were low (e.g. 3% and 9%).  Then the second method would simply say 
  875. 'Buy Bloggs', whereas in reality it would probably be inappropriate to buy 
  876. either of them.  The second method, using "Which Max" inference, makes the 
  877. decision for the user while the first method merely provides decision 
  878. support for the user.  This is often more useful since if two or more 
  879. options have approximately the same value (e.g. 85%, 87%, 82%) then it 
  880. might be appropriate to choose one that is not numerically the highest, for 
  881. extraneous reasons.
  882.  
  883. #  Let's review what we've done.  We have a KB by which the user can choose 
  884. between Acme and Bloggs shares, given information about both companies and 
  885. the strength of the market.  The KB is identical for each.  But in many 
  886. selector KBs there will be small variations between the knowledge.
  887.  
  888. #  Suppose Acme is a small company and Bloggs a large one, and the user 
  889. might have a preference for large or small companies.  Select Bayesian 
  890. again and create an item labelled 'Prefers small', meaning "I prefer small 
  891. company shares".  (Notice that this is information pertaining to the user, 
  892. not to the companies or their situation.  Perfectly valid.)  Then link it 
  893. to 'Buy Acme' with a positive link and to 'Buy Bloggs' with a negative 
  894. link.  From previous work both 'Buy Acme' and 'Buy Bloggs' will be answered 
  895. and their values shown as horizontal lines in their boxes.  (If not, make 
  896. sure they are.)  Then bring up the action panel for 'Prefers small' and 
  897. reset/infer it several times with various values.  Depending on the other 
  898. information, you should see the balance between the two shares change as 
  899. you change preference.
  900.  
  901. #  In a selector KB, which has knowledge on how to select between a small, 
  902. static number of known options (like the alloys above) you will find some 
  903. knowledge that is duplicated across the options, some that is common to all 
  904. (like 'Strong sector') and some that differentiates between the options 
  905. (like 'Prefers small').  This is a general pattern.
  906.  
  907. #  To summarize, in this section, we have (not in this order):
  908.  
  909.       #  Set up a selector KB
  910.       #  Noted that some knowledge must be duplicated, ..
  911.       #  .. but that some is common
  912.       #  .. and some differentiates
  913.       #  Noted how backward chaining lends intelligence
  914.       #  Dealt with the order of antecedents
  915.       #  Used graphical comparison of results
  916.       #  Used textual methods
  917.       #  Used the Block value type with automatic conversion to name
  918.       #  Used a selector inference method, "Which Max"
  919.       #  Discussed methods of comparison and selection.
  920.  
  921.  
  922. 9.  SELECTION: DECIDING WHAT CRITERIA TO JUDGE THEM ON
  923.  
  924. The previous section looked at the construction of a KB to select between a 
  925. small number of known options, such as alloys.  In company shares we do not 
  926. have a small number of known options, but rather a large number of options 
  927. which are not known until we run the KB.  That is, between yesterday's run 
  928. and today's five new companies might have come into existence and another 
  929. twelve might have gone bust.  In such domains it is better to take a 
  930. different approach to selection.  I also found that this approach was 
  931. needed when selecting tree species suitable for planting on a particular 
  932. plot of land.
  933.  
  934.       The approach we take here is not to hold knowledge of each and every
  935. option in the KB, but rather to use the KB to decide what selection 
  936. criteria should be used.  Then these selection criteria can be applied to a 
  937. database containing thousands of options (companies, tree species, etc.) 
  938. and the best few examined more closely.
  939.  
  940.       "But why not just use the database direct and apply a SQL query?" you
  941. may ask.  The answer is that with each run a different set of selection 
  942. criteria must be used, so that if we just used SQL direct we would have to 
  943. write a complex SQL statement each and every run.  In effect, the KB holds 
  944. the knowledge on how to write the SQL statement needed for each run. 
  945. (Though we will not attempt that in this section, one could do so with the 
  946. current version of Istar, using string value types and the "Concat" 
  947. inference method).
  948.  
  949.       Also - and this is what we found in the tree selector KB - simple SQL
  950. or database access is not enough.  It is better if the KB itself can 
  951. perform inference on data values obtained from the KB.  SQL etc. do not 
  952. normally have bayesian mechanisms built into them.
  953.  
  954.       This kind of KB is rather more sophisticated in structure (as well as
  955. in detail) than the ones above.  In the ones above, three kinds of 
  956. information came together into the eventual goals:
  957.  
  958.       a)  about the requirements of the user
  959.       b)  about the general situation, common to all options
  960.       c)  about each specific option.
  961.  
  962. In this kind of selector, they separate out to some extent.  First we use 
  963. (a) and some of (b) to arrive at a set of selection criteria, then we apply 
  964. these to (c) and some more of (b) to find the relative attractiveness of 
  965. each of the options.  In this kind of selector, (c) is often held in the 
  966. database, but inferences from it must be made in the KB (not just in SQL) 
  967. as discussed above.
  968.  
  969.       We will build a small KB for the first phase of a tree species
  970. selector.  It will first be a simple KB using facilities we have already 
  971. met above.  Then we will refine, learning new facilities and approaches as 
  972. we do so.
  973.  
  974. #  Move the easel so that the whole screen is empty.
  975.  
  976. #  Select bayesian item type.
  977.  
  978. #  The goals.  Lay down, to the right, boxes for three selection criteria:
  979.  
  980.       #  'High timber yield',
  981.       #  'Hardy',
  982.       #  'Good cover',
  983.  
  984. with meanings like:
  985.  
  986.       #  "It is important that trees have a good yield of timber",
  987.       #  "It is important that trees are hardy and can stand vandalism",
  988.       #  "It is important that trees provide good ground cover for wildlife
  989.       and game."
  990.  
  991. These are our three criterion for selection of tree species.  Click the 
  992. Show Value box for each so that we can see easily the importance of each 
  993. criterion.
  994.  
  995. (Tip:  Might be useful to shorten the meanings so that more than the common 
  996. part ("It is important that trees") appear in the mouse-position window. 
  997. For instance, make the meanings like "Trees must have a good yield of 
  998. timber.")
  999.  
  1000. #  Over the left hand side, place boxes to represent the requirements of 
  1001. the user:
  1002.  
  1003.       #  'Financial return'
  1004.       #  'Timber'
  1005.       #  'Wildlife'
  1006.       #  'Near housing'
  1007.  
  1008. with meanings:
  1009.  
  1010.       #  "Planting is for financial reasons"
  1011.       #  "The income is to be from timber"
  1012.       #  "The planting should be good for wildlife"
  1013.       #  "The planting is near housing".
  1014.  
  1015. Notice that 'Near housing' is part of (b) above, while the others are part 
  1016. of (a).
  1017.  
  1018. #  In the middle, place a box:
  1019.  
  1020.       #  'Game'
  1021.  
  1022. with the meaning:
  1023.  
  1024.       #  "The planting should support game".
  1025.  
  1026. #  Link 'Financial return' to both 'High timber yield' and 'Game', because 
  1027. a money can be made either out of timber or game (pheasant shooting, etc.).
  1028.  
  1029. #  Link 'Timber' to 'High timber yield' with a positive link and to 'Game' 
  1030. with a negative link.  This means that if they don't want timber but do 
  1031. want a financial yield then it must be through game.
  1032.  
  1033. #  Link both 'Wildlife' and 'Game' to 'Good cover'.  Both require good 
  1034. cover.
  1035.  
  1036. #  Link 'Housing nearby' to 'Hardy'.  This is because if there is housing 
  1037. nearby then children etc. will visit the wood and are likely to do some 
  1038. damage to the trees, so they must be hardy.
  1039.  
  1040. #  Now clear the goal list and put the three right hand criteria into it. 
  1041. (See above for how to do this if you've forgotten.)
  1042.  
  1043. #  Run it.  That is our basic tree selector KB.
  1044.  
  1045. #  (Its results show how much 'weight' should be given to each criterion 
  1046. when assessing each tree species.  Normally (i.e. apart from what-iffing) 
  1047. the KB would be run once to obtain such weights and then these would be 
  1048. applied to the data for all the tree species.  The algorithm for applying 
  1049. criterion weights to data will depend on need and data available, but might 
  1050. consist of multiplying each weight by the appropriate data and adding 
  1051. together.  For instance, if 'Hardy' turns out to be high (90%) and 'High 
  1052. timber yield' low (10%), then a tree with a hardiness factor of 8 out of 10 
  1053. and a yield factor of 2 out of 10 the total would be 8 * 90% + 2 * 10% = 
  1054. 7.2 + 0.2 = 7.4.  For a tree with a hardiness factor of 2 and a yield 
  1055. factor of 8 the result would be 2 * 90% + 8 * 10% = 1.8 + 0.8 = 2.6.  So 
  1056. the former tree species would be preferred.  If running the KB had resulted 
  1057. in the opposite weights being given then the tree preferences would be 
  1058. reversed.)
  1059.  
  1060. #  This KB demonstrates basically how to set up this type of selector: have 
  1061. a group of items that represent the selection criteria, a group that 
  1062. represent the user requirements and a group that represent the common 
  1063. situation, and link them together.
  1064.  
  1065. #  Did you notice that even if you said you did not want a financial return 
  1066. it still asked you whether the income should be from timber or not.  (If 
  1067. you didn't notice it, run it again, answering -100 to 'Financial return'.) 
  1068. This is obviously not right.  So we will use a couple of facilities of 
  1069. Istar to amend it.
  1070.  
  1071. #  First, if the demand for financial return is low then there is little 
  1072. point in asking about 'Timber'.  Istar offers a cut-off on bayesians; you 
  1073. might have noticed the two gadgets on the bayesian attribute detail panel 
  1074. called LCO and UCO.  These are lower and upper cut-off, and when zero they 
  1075. are ignored.  But when not zero they come into play.  Take the lower cut-
  1076. off, LCO.  If LCO is 30% then as soon as it is certain that the probability 
  1077. value of the attribute cannot exceed 30% then the attribute is considered 
  1078. answered and no more of its antecedents are sought by backward chaining. 
  1079. This can be used to stop questions about 'Timber' when it is known that 
  1080. there is no financial interest.  Conversely with the upper cut-off, UCO.
  1081.  
  1082. #  Set the LCO of 'High yield' to 30%.
  1083.  
  1084. #  To use the cut-offs effectively we need to alter the weights of 
  1085. evidence.  So far we have used mild weights of 3/1 and 1/3, symmetrical 
  1086. about unity.  We need to give the link a strong asymmetry to pull the 
  1087. consequent down to near zero when the antecedent ('Financial return') is 
  1088. low.  Then, whatever value the other antecedent takes it will never rise 
  1089. above the LCO and so they will not be asked.  (For an understanding of 
  1090. weights, see the section in <Inference> on bayesians.)
  1091.  
  1092. #  Bring up the relationship instance panel for the link between 'Financial 
  1093. return' and 'High yield'.  It has four integers in four boxes called 
  1094. 'Weight', and they should be 3/1 and 1/3.  Set the fourth box to 30 rather 
  1095. than 3.  (Also, ensure that the unary operator is 'Normal', not 'Negate'.)
  1096.  
  1097. #  Now run the KB from just 'High yield' and answer 'Financial return' with 
  1098. -100.  It should now not ask about 'Timber'.  (If it does, perhaps you have 
  1099. run it by clicking Reset Goals and Infer Goals, because 'Timber' is still 
  1100. needed for 'Game', or perhaps you have not set the LCO of 'High yield' to 
  1101. 30%.)
  1102.  
  1103. #  To stop bayesian questioning we must therefore do two things: set the 
  1104. LCO (or occasionally the UCO) and set the weights on the link from the 
  1105. controlling antecedent.  So we must also do this for 'Game'.  Set its LCO 
  1106. also to 30% and set the weight on the link between 'Financial return' and 
  1107. 'Game' to 3/1, 1/30.  Then 'Timber' should only be asked if the 'Financial 
  1108. return' is answered more positively than about -30.
  1109.  
  1110. #  To summarize, in this section we have:
  1111.  
  1112.       #  Built a KB to assign weights to selection criteria
  1113.       #  .. which can then be applied to a database of options
  1114.       #  Recognised some different classes of information
  1115.       #  Found one way of preventing irrelevant questions being asked
  1116.       #  .. by employing lower (or upper) cut-off on a bayesian
  1117.       #  .. and by setting the weight of evidence on a link.
  1118.  
  1119.  
  1120. 10.  CAUSAL MODELS
  1121.  
  1122. Istar can be used to built certain types of causal model.  A causal model 
  1123. tries to express what happens in some limited area of activity, such as 
  1124. machinery, electronics, biological systems, the weather, social systems, 
  1125. history and many more.  Some are deterministic, some normative (that is, 
  1126. there are laws that pertain but entities are not forced to obey them). 
  1127. With a causal model we can predict what will happen, and a major use is 
  1128. simulation (e.g. simulate the weather, or simulate an electronic circuit to 
  1129. see whether it will malfunction, or simulate social development).
  1130.  
  1131.       The more normative, the more 'fuzzy' the information about them and
  1132. less accurately can we predict or simulate.  Determinative models can often 
  1133. make use of numeric and boolean information while bayesians and 
  1134. probabilities are more useful for normative models.
  1135.  
  1136.       As you might have realised, the predictive KB above was a simple kind
  1137. of causal model.  The causality was economic and logical in nature rather 
  1138. than physical, and perhaps social and ethical, but it was still a valid 
  1139. kind of causality.  There are grounds in philosophy for seeing logical 
  1140. entailment as a form of causality.  In the same way evaluation and 
  1141. selection can involve causality.  That is why the same KB could be used, 
  1142. with minor alterations, for all these purposes.
  1143.  
  1144.       But there one purpose of a KB that does not normally make use of a
  1145. causal model - diagnosis.
  1146.  
  1147.  
  1148. 11.  DIAGNOSING WHY IT WENT WRONG OR RIGHT
  1149.  
  1150. Diagnosis is finding out what went wrong.  Or, more generally, what some 
  1151. initial state was that resulted in the observed final state.
  1152.  
  1153.       In most of the uses for KBs we have looked at so far (evaluation,
  1154. understanding, prediction, etc.) the inference has followed and modelled 
  1155. the causality, so that input information is of some initial state or cause 
  1156. and output information is of an outcome.  But in diagnosis inference and 
  1157. causality flow in opposite directions, so that input information is of the 
  1158. outcome and output information is about the initial state or cause.  This 
  1159. gives a diagnostic KB a different flavour, though it employs exactly the 
  1160. same inference mechanisms.
  1161.  
  1162.       We will construct a small KB that seeks to explain why a certain
  1163. company share did not give us good profits, why it went down in value when 
  1164. we expected it to go up.
  1165.  
  1166.       First, note that the causal KB we have used so far could in principle
  1167. be used for diagnosis.  To do so we would try all combinations of input 
  1168. information and see which ones gave the state we now observe of an 
  1169. unattractive share.  (Try it if you like: run it several times and see 
  1170. which combinations give low belief that we should 'Buy it'.)  But there are 
  1171. two problems:
  1172.  
  1173.       a)  it is cumbersome and time consuming (many combinations)
  1174.  
  1175.       b)  it cannot be very specific, in that there are several reasons why
  1176.       we are not advised to 'Buy it', and we do not know which was the one
  1177.       that functioned in this instance.
  1178.  
  1179.       So we need to build a different type of KB, in which the goal
  1180. attributes on the right hand side are such things as 'Was not strong 
  1181. sector', 'Management had no vision', etc. and the input information on the 
  1182. left hand side includes what was our goal above (negated) 'Should not have 
  1183. bought it' and other information which we have not represented above.
  1184.  
  1185. #  The first thing we can do is to try reversing the KB we have.  Load 
  1186. 'R1'.  Rather than reverse the actual KB we will create another below it, 
  1187. reversed.  Move the easel down so there is space below it but so that the 
  1188. original KB can be seen.  Squash some of its items up a bit to make room 
  1189. (and also to ensure that the main easel is active).
  1190.  
  1191. #  Move the mouse over 'Buy it' and press the 'T' key.  This selects item 
  1192. type to be the same type as the one under the mouse.  It's usually more 
  1193. convenient than using the select item type panel, and here we will make 
  1194. good use of it.
  1195.  
  1196. #  Place an item to the left hand side, corresponding to 'Buy it', but 
  1197. label it something like 'ShdNotHaveBought' with meaning like "We should not 
  1198. have bought this share".
  1199.  
  1200. #  Now select the type for 'Will' using the 'T' key, and place a box to the 
  1201. right of 'ShdNotHaveBought' and above, labelled 'DidNotGrow' with suitable 
  1202. meaning.  (Of course, in this KB most items are free bayesians, so strictly 
  1203. we don't have to keep using the 'T' key.  But it is a good habit to get 
  1204. into.)
  1205.  
  1206. #  Do similarly for 'More Profits', perhaps labelling it 'ProfitsFell'.
  1207.  
  1208. #  (Tip:  Notice the different style of labelling, without spaces; because 
  1209. the labels seem to be longer, but it could be useful as a visual way of 
  1210. distinguishing between casual and diagnostic knowledge.)
  1211.  
  1212. #  Link 'ShdNotHaveBought' as antecedent to both these.  (Note: antecedence 
  1213. and consequence is reversed.)
  1214.  
  1215. #  Then do similarly for all other items/attributes in the original KB, 
  1216. creating one below it that is the mirror image of it.
  1217.  
  1218. #  Now, what do you notice about this KB?  It has only one input variable, 
  1219. from which all the others are derived.  So, however it is answered, there 
  1220. will be no real way of distinguishing between what are now the inference 
  1221. goals.  We cannot tell whether it was lack of vision or weakness of the 
  1222. sector or any other factor that meant the shares did not do well.  We must 
  1223. add some further information to help us do so.
  1224.  
  1225. #  One way to do this is to focus on one of the factors that could have 
  1226. been a cause, such as 'SectorWasWeak' and ask "What else would weakness in 
  1227. the sector have led to?"  For instance, if the sector as a whole was weak 
  1228. then other firms in that sector would also have been weak.  So, if other 
  1229. firms also did badly then this is evidence that sector weakness was the 
  1230. problem, but if other firms did well then this is unlikely to have been the 
  1231. problem.
  1232.  
  1233. #  Add a bayesian 'OthersDidBadlyToo' as antecedent of 'SectorWasWeak'.
  1234.  
  1235. #  Maybe you also want to set the LCO of 'SectorWasWeak' then on its 
  1236. attribute list select 'DidNotGrow' and click the 'R' button to bring up the 
  1237. relationship instance panel.  Set the fourth weight figure to 60.  This 
  1238. will prevent 'OthersDidBadlyToo' from being asked if in fact the company 
  1239. did grow.
  1240.  
  1241. #  In the same way, ask "What else would have happened if the company did 
  1242. not grow?"  e.g. The turnover would have stayed the same, or the number of 
  1243. employees would have stayed the same or reduced.  Take one or both of these 
  1244. as evidence for 'DidNotGrow' in the same way.
  1245.  
  1246. #  Note that instead of asking about belief in the negative statement 
  1247. 'TurnoverDidNotIncrease' you could ask the positive statement 
  1248. 'TurnoverIncreased' and link it to 'DidNotGrow' as negative evidence (that 
  1249. is, with a unary operator of Negate).  You will come across many situations 
  1250. where it might be better to reverse a proposition and thus all its 
  1251. relationship (both antecedent and consequent).
  1252.  
  1253. #  (Knowledge refinement:  Instead of asking about turnover and employees 
  1254. separately, perhaps what we want is simply to ask "Did the company in fact 
  1255. grow during this period?")
  1256.  
  1257. #  In the same way, asking "What else could xxx have led to?", and linking 
  1258. what you come up with as antecedence for xxx, you can build a diagnostic 
  1259. KB.  Be sensitive to the possibility that one of these factors might be 
  1260. caused by several factors in your KB, in which case it should be linked as 
  1261. antecedent to them all.
  1262.  
  1263. #  To summarize, in this section we have:
  1264.  
  1265.       #  Noted the different nature of diagnostic knowledge.
  1266.       #  Reversed a KB.
  1267.       #  Used the quick same type facility ('T' key)
  1268.       #  Enriched our KB using the What else question.
  1269.       #  Noted that it might be useful to reverse a proposition.
  1270.  
  1271.  
  1272.  
  1273. 12.  MAKING YOUR KB MORE ACCURATE
  1274.  
  1275. So far most of the links in your KB have had the same weight and the a-
  1276. priori settings have remained at 50%.  This is obviously not true to real 
  1277. life.  Some factors are more important than others.  In this section we 
  1278. start to tailor some of the weights (strengths) of links and set the a-
  1279. priori probabilities of your bayesian attributes.
  1280.  
  1281. #  The a-priori probability is the foundation of bayesian evidence.  It 
  1282. forms the base point, to which to add evidence as it is collected.  It is 
  1283. the starting belief in the proposition represented by the bayesian, the 
  1284. belief you would have in it if you could obtain no evidence one way or 
  1285. another.  Usually the a-priori is the statistical probability of the 
  1286. proposition being true for the class of situations in which you will use 
  1287. the KB.
  1288.  
  1289. #  Load the 'R1' KB that you saved earlier.
  1290.  
  1291. #  Bring up the 'Buy it' attribute details panel.  Given 100 different 
  1292. companies, on average how many of them would you consider their shares 
  1293. attractive?  10%?  30%?  50%?  70%?  Suppose your answer were 20%, then 
  1294. find the 'AP' slider gadget to the right of the main value and move it to 
  1295. 20.  You have set the a-priori.
  1296.  
  1297. #  Now ask yourself the equivalent question ("Given 100 different 
  1298. companies, on average how many of them will grow?" etc.) for all other 
  1299. bayesians in the KB, and adjust their a-prioris to suit.
  1300.  
  1301. #  It's basically a simple operation to set the a-priori and with a little 
  1302. practice it becomes almost second nature.  But there can be difficulties, 
  1303. especially when you start off.
  1304.  
  1305. #  One is that you start to think, "Well, it depends ..."  On what?  One is 
  1306. that it might depend on sector.  If you can identify a factor on which this 
  1307. average depends then that factor is actually a piece of evidence that 
  1308. should be incorporated into your KB.  It depends on sector?  Then make the 
  1309. influence of sector a piece of evidence, and then you change your a-priori 
  1310. question to "Given 100 companies, when I take the average across all 
  1311. sectors, how many of them ...?"
  1312.  
  1313. #  (Notice how asking the a-priori question sometimes helps in knowledge 
  1314. refinement by forcing hidden influences out into the open.)
  1315.  
  1316. #  'Will grow' depends on sector, and that is already taken care of, via 
  1317. the item 'Strong sector'.  But perhaps 'Vision for growth' also depends on 
  1318. sector, in that in certain sectors the culture of that sector is for growth 
  1319. while in others it is not.  The I.T. sector tends to have a growth culture 
  1320. while the agricultural sector might not.  The construction industry at 
  1321. present is still in recession.  The sports sector seems to have a culture 
  1322. of growing.  So let us take these four as an example.  We will employ yet 
  1323. another facility of Istar, the Chooser inference method.
  1324.  
  1325. #  What we want is a piece of evidence for 'Vision for growth' that depends 
  1326. on sector.  Place a bayesian 'Sector vision' as antecedent to it.  Bring up 
  1327. its attribute details panel and change its inference method to Chooser. 
  1328. The Chooser takes an integer (or an Enum or Ordinal) as its first 
  1329. antecedent, and then all the others should normally be the same type as the 
  1330. consequent.  The Chooser first finds the value of the first antecedent. 
  1331. Then, if 1, it takes the first of the rest (i.e. the second antecedent), if 
  1332. 2 it takes the 2nd of the rest, and so on, and copies its value into the 
  1333. consequent.  In this case the attributes from which it chooses will be 
  1334. sector constants.
  1335.  
  1336. #  Select Integer item type and place an integer attribute as antecedent to 
  1337. 'Sector vision'.  Label is 'Sector Id' with meaning "The identifier for the 
  1338. sector".  Give it a question text of "To which sector does the company 
  1339. belong?  1 = I.T., 2 = Agriculture, 3 = Construction, 4 = Sports".  (For a 
  1340. less clumsy method than this long question, see Enumerated Types below.)
  1341.  
  1342. #  Now create four bayesian attributes as antecedents to 'Sector vision' 
  1343. and, by bringing up their attribute panels, make each a Constant.  Then 
  1344. give each a name and value something like:
  1345.  
  1346.       'I.T. vision'  90%
  1347.       'Agriculture vision'  10%
  1348.       'Construction vision' 20%
  1349.       'Sports vision' 60%
  1350.  
  1351. Try resetting and inferring 'Sector vision' to see what you obtain with 
  1352. different values of the Id.
  1353.  
  1354. #  (If you wish, you could also change 'Strong sector' from being an input 
  1355. information to a Chooser controlled by 'Sector Id' and to take its value 
  1356. from a similar bank of constants.  Then, by answering 'Sector Id', the user 
  1357. would automatically supply values to both 'Strong sector' and 'Sector 
  1358. vision'.)
  1359.  
  1360. #  Now, don't forget to set the a-priori for 'Vision for growth' as an 
  1361. average across all sectors.  If you expect about the same number of 
  1362. companies in each sector then you could just take the average of the 
  1363. sectors you are dealing with (90+10+20+60/4=45%).  The a-priori for 'Sector 
  1364. vision' can stay at 50% since it is merely a modifying factor.
  1365.  
  1366. #  (Tip:  Don't worry too much about accuracy of a-prioris or weights; they 
  1367. are more tolerant than you might think.)
  1368.  
  1369. #  We have dealt with a-prioris.  Now to deal with weights of evidence.  We 
  1370. will take as an example the item 'Will grow' and its antecedents 'Strong 
  1371. sector' and 'Vision for growth'.  In doing so we deal with odds rather than 
  1372. probabilities.  Odds and probabilities are linked as:
  1373.  
  1374.       O = P / (1 - P)
  1375.  
  1376. and
  1377.  
  1378.       P = O / (1 + O).
  1379.  
  1380. In Istar odds are held as two integers, numerator and denominator.
  1381.  
  1382. #  Let us suppose you have set the a-priori for 'Will grow' to 25%.  Its 
  1383. odds are therefore 0.25 / (1 - 0.25) = 0.25 / 0.75 = 1/3 ("one to three 
  1384. against").
  1385.  
  1386. #  For each antecedent we ask two questions:
  1387.  
  1388.       QT:  "Suppose we know that the antecedent is completely true; then
  1389.       what would the belief in the consequent be?" and
  1390.  
  1391.       QF:  "Suppose we know that the antecedent is completely false; then
  1392.       what would the belief in the consequent be?"
  1393.  
  1394. Ask them of 'Strong sector':  "Suppose we know for certain that it is a 
  1395. strong sector; what would our belief in 'Will grow' be?"  and conversely. 
  1396. Suppose we find QT gives 75% (odds = 3/1) and QF gives 10% (odds = 1/9).
  1397.  
  1398. #  This gives us the means to work out the weights on the link between 
  1399. them.  QT provides the left hand pair of numbers on the relationship 
  1400. instance panel, and QF the right hand.  Bring up the panel.
  1401.  
  1402. #  Each pair is an odds multiplier, such that when multiplied into the a-
  1403. priori odds of the consequent gives the answer to QT and QF respectively. 
  1404. Take the left hand pair and QT.
  1405.  
  1406.       A-priori odds of 'Will grow' = 1/3.
  1407.       Answer to QT = 3/1.
  1408.       Therefore odds multiplier must be 9/1.
  1409.  
  1410. So alter the left hand pair to 9/1.
  1411.  
  1412. #  In a similar way, the right hand pair and QF:
  1413.  
  1414.       A-priori odds of 'Will grow' = 1/3.
  1415.       Answer to QF = 1/9.
  1416.       Therefore odds multiplier must be 1/3 (which it already is).
  1417.  
  1418. Click on the 'OK' button.
  1419.  
  1420. #  Now process the others link weights in a similar manner:
  1421.  
  1422.       #  Convert the a-priori of the consequent to odds.
  1423.       #  Ask QT for the antecedent and consequent.
  1424.       #  Convert the answer to odds.
  1425.       #  Alter the left hand odds multiplier as appropriate.
  1426.       #  Ask GF and convert the answer to odds.
  1427.       #  Alter the right hand odds multiplier as appropriate.
  1428.  
  1429. #  Save the KB as 'R2'.
  1430.  
  1431. #  Now run the KB.  You should start to find the results are more 
  1432. meaningful and interesting than before.
  1433.  
  1434. #  To summarize, in the section we have:
  1435.  
  1436.       #  Concerned ourselves with KB accuracy.
  1437.       #  Met with a-priori probabilities for bayesians
  1438.       #  Found a simple question to ask to calculate them.
  1439.       #  Noted that this can unearth other factors.
  1440.       #  Used the Chooser.
  1441.       #  Set the weights of evidence ..
  1442.       #  .. by using odds and two simple questions.
  1443.  
  1444.  
  1445.  
  1446. 14.  MAKING YOUR KBS MORE USABLE
  1447.  
  1448. In this section we note some ways to make the KB more usable, easier to 
  1449. use, more friendly to the user.
  1450.  
  1451. #  Enumerators
  1452.  
  1453. The Chooser was driven by an integer, which meant the question text had to 
  1454. be cumbersome.  A more serious problem was that the user was free to enter 
  1455. any value.  Future versions of Istar might have value checking on input for 
  1456. integers etc. but a better method is available now: use an Enumerated Type.
  1457.  
  1458.       An enumerated type is an identifier of which option is selected from
  1459. a set, e.g. which business sector.  One is already available as standard: 
  1460. Weekdays.  But we must create another.
  1461.  
  1462. #  Load 'R2' if not already up.
  1463. #  On main control panel, click the Atts button.
  1464. #  (See Driving section on Creating New Attributes for details.)
  1465. #  Add a new attribute whose name is 'Sector' and whose type is Enumerated.
  1466. #  Remember to click the left Add button.
  1467. #  On the right hand side, enter in the 'N' gadget "I.T." and click Add.
  1468. #  Enter "Agriculture" and click Add.
  1469. #  Enter "Construction" and click Add.
  1470. #  Enter "Sports" and click Add.
  1471. #  Click Done.
  1472. #  Bring up the attribute details panel for 'Sector Id'.  Click the value 
  1473. type wee button to bring up list of attribute types.  Select 'Sector'. 
  1474. Click 'OK' on the type list.
  1475. #  Now click 'OK' on the attribute details panel.
  1476. #  Reset/infer 'Sector vision' and you should find it will no longer ask 
  1477. you for an integer but give you a cycle gadget showing the sector names.
  1478. #  Now you can change the question text for 'Sector Id' to suit.
  1479.  
  1480.       It is often useful to create Enumerated types for the major
  1481. identifiers your KB uses.  Some will be Enums, some Ordinals.  Ordinals 
  1482. differ from Enums in that the options are in some numeric order rather than 
  1483. being just options.  e.g. Low, medium and high.
  1484.  
  1485.  
  1486. #  The order in which questions are asked
  1487.  
  1488. The order in which questions are asked is seldom important to the final 
  1489. results given by a KB but can make a lot of difference to the user.  For 
  1490. instance it is sensible to have the major questions at the start and also 
  1491. to try to put questions relating to a given topic together.  The order in 
  1492. which they are asked depends on the backward chaining process, the 
  1493. inference methods employed and the answers to previous questions.  But 
  1494. there are several ways of controlling the order of asking.
  1495.  
  1496. #  By altering the order of antecedents of an inference attribute.
  1497. #  By understanding the order imposed by certain inference methods.  For 
  1498. instance, in Chooser the first antecedent must be completely asked and 
  1499. answered before any of the others are sought, so all the questions that 
  1500. pertain to the first will be asked first.  Similarly, in the comparison 
  1501. methods (A > the rest, etc.) the first must be asked first.
  1502.  
  1503.  
  1504. #  Suppressing irrelevant questions
  1505.  
  1506. Often certain questions are irrelevant to the flow of the run of a KB.  For 
  1507. instance for the I.T. sector it is irrelvant to ask about farming 
  1508. practices.  There are various ways to prevent irrelevant questions being 
  1509. asked.
  1510.  
  1511. #  The Chooser.  This will backward chain only up the chosen route and will 
  1512. ignore the others.
  1513. #  Bayesian cut-offs.  Setting these will stop seeking input once it is 
  1514. certain that the value of the bayesian attribute either cannot exceed the 
  1515. lower cut-off or cannot be less than the upper cut-off, however the 
  1516. remaining unanswered antecedents are answered.
  1517. #  Certain arithmetic and logical inference methods stop when an extreme 
  1518. answer is known.  e.g. the process stops when: one of the antecedents is 
  1519. zero in multiplication, when one is false in boolean AND, when one is true 
  1520. in boolean OR.
  1521. #  In the comparisons that give a boolean result, as soon as the comparison 
  1522. fails the process stops.  So "A > the rest" will stop as soon as one of the 
  1523. rest is found to be >= A.
  1524.  
  1525.  
  1526. #  Forms
  1527.  
  1528. The normal method of obtaining information when running a KB in Istar is 
  1529. question by question, since that allows the session to be most responsive 
  1530. to the way information given.  But sometimes it is useful to have several 
  1531. related pieces of information all on the same screen.
  1532.  
  1533.       For this, Istar offers a simple 'Forms' facility.
  1534.  
  1535. #  (Load a KB, such as R1.)
  1536. #  Select 'Form' item type.
  1537. #  Place an item of this type to the left of a number of attributes on your 
  1538. KB.  Notice it has no name (though it can be given one).
  1539. #  Then, draw a link from the Form item to one of the attributes.
  1540. #  Then to another, and another.
  1541. #  Run the whole KB.  You should find that the three attributes you have 
  1542. linked to the form are all presented on a single screen.
  1543. #  Answer them all, and click 'OK'.
  1544. #  Allow the rest of the questions to be asked.
  1545. #  Now click with right mouse button on the form item, and up comes an item 
  1546. details panel.
  1547. #  Enter a name (label), some meaning.
  1548. #  Enter Form Text such as "Please give values for the following:".
  1549. #  Click 'OK'.
  1550. #  The label should now appear in the form box on the easel and the meaning 
  1551. appear in the window when you move the mouse over it, just as with 
  1552. attributes.
  1553. #  Run the KB and this time your Form Text should appear at the head of the 
  1554. form.
  1555.  
  1556.       This facility is as yet undeveloped; new versions should appear
  1557. later.
  1558.  
  1559.  
  1560. #  Requiring less detail of the user
  1561.  
  1562. As it stands, our KB will ask us two things about the quality of 
  1563. management.  As the KB develops we might find these split into several 
  1564. more, which can feel rather too detailed to the user.  For this reason it 
  1565. is sometimes useful to first ask a more general question about the overall 
  1566. quality of management and derive these other factors from that.  Then, only 
  1567. when detail is needed, ask these factors separately.
  1568.  
  1569.       There are several ways of doing this.  The easiest is to link all the
  1570. management factors back to 'Good management' as their single antecedent, 
  1571. and give weights accordingly.
  1572.  
  1573.       But that does not differentiate much: they will all rise and fall
  1574. together.  There are several ways to overcome this, such as have another 
  1575. item that asks whether the management's strengths are in marketing, 
  1576. production or finance, and sets the various factors accordingly.
  1577.  
  1578.  
  1579. 15.  USING ISTAR FOR SEMANTIC NETS AND MIND MAPS
  1580.  
  1581. In all the above, we have concentrated on inference nets; now we turn to 
  1582. semantic nets which, in the simple form supported by Istar, are like the 
  1583. Mind Maps common in the decision support arena.  Istar isn't yet ideal for 
  1584. these, but can still be very useful.
  1585.  
  1586.       For semantic nets items and relationships are all important;
  1587. attributes are less important.  So we need to create new types of 
  1588. relationship and item for use in our net.  But, by now, you should have 
  1589. enough experience of Istar to be able to do this by yourself after reading 
  1590. the Panels document, in its sections on creating new item and relationship 
  1591. types.  So, instead of step by step instructions on how to create these, we 
  1592. will look at an example.  (This part of the tutorial applies only to 
  1593. versions 1.03 and later.)
  1594.  
  1595. #  Load the 'Philosophy' knowledge base and examine it.  It portrays some 
  1596. of the flow of philosophical thought up to the time just before the 
  1597. Reformation and Renaissance, as a semantic net.  The net is based on, and 
  1598. is my interpretation of, Survey of the History of Philosophy, classroom 
  1599. teaching notes by John Van Dyk, Professor of Philosophy, Dordt.
  1600.  
  1601. #  It shows many of the major Western philosophers and how they influenced 
  1602. each other's thinking.  Each has a name, a date and, as meaning, a brief 
  1603. description of their philosophical stance.  Move the mouse around to see 
  1604. their stances.
  1605.  
  1606. #  There is an 'Influence' relationship linking some of them.  This shows 
  1607. that, for instance, the thinking of Socrates influenced the thinking of 
  1608. both Plato and the Cynics.
  1609.  
  1610. #  Some influence links are a different colour; this shows a negative 
  1611. influence, in that the later thinking reacted against the earlier and 
  1612. developed in an opposing direction.  For instance, Tertullian called Plato 
  1613. "the father of all error".
  1614.  
  1615. #  Peruse the whole KB, and see what you pick up about philosophers and how 
  1616. Western thinking developed up to the Middle Ages.  Alter things if you 
  1617. disagree with them.
  1618.  
  1619. #  Notice three things.  First, notice how you do actually learn something 
  1620. new by persuing the KB; it is like a book.  (But, in this basic version, 
  1621. don't expect to learn too much!)  Second, many of the terms you will not 
  1622. understand.  In a mind map this can be a problem, so when you make up a 
  1623. mind map, think about how to make things more understandable.  Third, if 
  1624. you know something of philosophy, you might wonder whether some links are 
  1625. missing; some undoubtedly are, but notice how it has stimulated you to 
  1626. think - a form of knowledge refinement mentioned above.
  1627.  
  1628.       The Philosophy KB bundled with version 1.03 of Istar is fairly basic,
  1629. and will hopefully be extended in the near future, especially to use 
  1630. Topics.
  1631.  
  1632.  
  1633.  
  1634. Copyright (c) Andrew Basden, 1996
  1635.